
var height = $(window).height();
	height = height - 45 - 41 - 64;
	var hstr = height + 'px';
	$('#page-content').css('height',hstr);

$.ajax({
	url:"../diagnose/getWindFarmList.do",
	type:"POST",
	dataType : "json",
	success:function(data){
		var windfarm = eval(data.resBody);
		for(var i=0; i<windfarm.length; i++){
			var tableStr = "<tr><td class='farmid'>"+windfarm[i].farmid+"</td><td>"+windfarm[i].farmname+"</td><td class='selected'>";
			if(windfarm[i].turbine.length != null)
				for(var j=0; j<windfarm[i].turbine.length; j++)
					tableStr = tableStr + '<input name="' + windfarm[i].farmid + '" type="checkbox" checked="checked"/>' + windfarm[i].turbine[j]; 
			var statusStr = windfarm[i].mtime==null?'从未更新':windfarm[i].mtime;
			tableStr = tableStr + '</td><td>' + statusStr + '</td>';
			var disabledStr = '';
			if(windfarm[i].turbine.length == 0)
				disabledStr = "disabled='disabled'";
			if(windfarm[i].etl == 2 || windfarm[i].etl == 1)
				tableStr = tableStr + '<td><i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i><span class="orange">更新中..</span></td></tr>';
			else
				tableStr = tableStr + "<td><input type='button' " + disabledStr + " value='更新' class='btn'/></td></tr>";
			$("#contentList").append(tableStr);
		}
		$(".btn").click(function(){
			var farmid = $(this).parent().closest("td").siblings(".farmid").text();
			$(this).replaceWith('<i class="ace-icon fa fa-spinner fa-spin orange bigger-125"></i><span class="orange">更新中..</span>');
			$.ajax({
				url:"../diagnose/extractData.do",
				type:"POST",
				dataType:"json",
				data:{farmid:farmid},
				success:function(data){
					popTipInfo("数据正在后台更新中..",'S');
				}
			});
		});
	}
});